#pragma once

#include "ui_control.h"

_SSL_BEGIN
_SSUIL_BEGIN

#pragma warning(push)
#pragma warning(disable:4250)

class SSUI_CLASS UIFocusableControl :
	public UIControl
{
public:
	UIFocusableControl();
	virtual ~UIFocusableControl();

public:
	virtual bool ApplyAttributes(IUIBuilderInterface *ui_builder, 
		IUIXMLDocumentInterface *xml_document, UIXmlNode node);
	virtual void DoEvent(UIEvent &evt);
	virtual UINT GetProperties();
	virtual void DoAction();

protected:
	virtual unsigned long GetBackgroundColor();
	virtual UIPresetImage& GetBackgroundImage();

public:
	bool IsOverSensitive();
	void SetOverSensitive(bool flag);
	bool IsPressSensitive();
	void SetPressSensitive(bool flag);
	bool IsFocusSensitive();
	void SetFocusSensitive(bool flag);

	bool SetFocus(bool f);
	bool IsFocused();

	void SetOveredBackgroundColor(unsigned long color);
	void SetOveredBackgroundImage(const UIPresetImage &img);
	void SetPressedBackgroundColor(unsigned long color);
	void SetPressedBackgroundImage(const UIPresetImage &img);
	void SetFocusedBackgroundColor(unsigned long color);
	void SetFocusedBackgroundImage(const UIPresetImage &img);

	void SetFocusedOveredBackgroundImage(const UIPresetImage &img);
	void SetFocusedPressedBackgroundImage(const UIPresetImage &img);

public:
	event_source OnClick;

protected:
	bool overed_;
	bool over_sensitive_;
	bool pressed_;
	bool press_sensitive_;
	bool focus_sensitive_;

	unsigned long background_overed_color_;
	UIPresetImage background_overed_image_;
	unsigned long background_pressed_color_;
	UIPresetImage background_pressed_image_;
	unsigned long background_focused_color_;
	UIPresetImage background_focused_image_;

	UIPresetImage background_focused_overed_image_;
	UIPresetImage background_focused_pressed_image_;
};

#pragma warning(pop)

_SSUIL_END
_SSL_END
